﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ChinessChess
{
    public partial class frmLogIn : Form
    {
        public frmLogIn()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            DataChessDataContext db = new DataChessDataContext();
            var query = from p in db.tblRegisters 
                        where p.username == txtUser.Text && p.pass==txtPass.Text
                        select p;
            if (query.Count<tblRegister>()>0)
            {
                Form1 f = new Form1();
                f.ShowDialog();
            }
            else
            {
                MessageBox.Show("User hay mat khau khong dung.Neu chua dang ky vui long nhan nut dang ky!!!");
                return;
            }
        }

        private void btnDangky_Click(object sender, EventArgs e)
        {
            Frmregister f = new Frmregister();
            f.ShowDialog();

        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}
